<template>
  <div class="zong">
    <CheckButton :is-checked="product.checked" @click.native="checkClick" />
    <div class="tu"><img :src="product.image" alt="" /></div>
    <div class="title">
      <div>
        {{ product.title }}
      </div>
      <div>
        {{ product.desc }}
      </div>

      <div class="price">
        <span>￥{{ product.price }}</span>
        <span>×{{ product.count }}</span>
      </div>
    </div>
  </div>
</template>
<script>
import CheckButton from "./CheckButton.vue";
export default {
  name: "CartListItem",
  components: {
    CheckButton,
  },
  props: {
    product: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  methods: {
    checkClick() {
      this.product.checked = !this.product.checked;
    },
  },
};
</script>
<style scoped>
.zong {
  position: relative;
  width: 100vw;
  padding: 10px 10px 10px 0;
  border-bottom: 1px solid rgb(221, 220, 220);
  display: flex;
}

.tu {
  margin-left: 30px;
  flex: 2.5;
}
.title {
  flex: 7;
}
.title div {
  width: 240px;
}
.title div:first-child {
  font-size: 18px;
  margin: 10px 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.title div:nth-child(2) {
  margin: 20px 0;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgb(100, 100, 100);
}
.price {
  display: flex;
  margin-top: 30px;
}
.price span {
  font-size: 18px;
  flex: 1;
}
.price span:first-child {
  color: orange;
}
.price span:last-child {
  text-align: right;
}
img {
  width: 80px;
  border-radius: 10%;
}
</style>